﻿using MessageSystem.Managed.Interface;
using MessageSystem.Managed.Infrastructure;

namespace MessageSystem.Managed.LuaRpc
{
    class LuaMessage:IMessage
    {
        public int MessageId { get; set; }
        public ushort Flags { get; set; }
        public int Sessionid { get; set; }
        public int OpCode { get; set; }
	
        public string Json { get; set; }

        public void Read(NetStream stream)
        {
            Json = stream.ReadString();
        }
        
        public void Write(NetStream stream)
        {
			string json = "{\"Json\"" + ":" + "\"" + Json.Replace ("\"", "\\\"") +"\"}";
            stream.WriteString(json);
        }
    }
}
